% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ejscreenRESTbroker2table.R
\name{ejscreenRESTbroker2table}
\alias{ejscreenRESTbroker2table}
\title{Low-level utility to convert result of EJScreen API query into table format}
\usage{
ejscreenRESTbroker2table(brokeroutput, getstatefromplacename = TRUE)
}
\arguments{
\item{brokeroutput}{the results of \code{\link[=ejscreenRESTbroker]{ejscreenRESTbroker()}}}

\item{getstatefromplacename}{set to FALSE if you need the exact output of API and
TRUE if you want to try to extract ST abbrev and statename from the placename field,
which is more likely to be correct than the stateAbbr and stateName fields in the API output.}
}
\value{
a data.frame of 1 row (a site) and many columns (indicators)
}
\description{
Convert json output of \code{\link[=ejscreenRESTbroker]{ejscreenRESTbroker()}} to a simple 1-row data.frame
}
\details{
This function assumes we got the full results via the API
using \code{\link[=ejscreenRESTbroker]{ejscreenRESTbroker()}}.

It handles all 300 or so indicators, including those categorized by API outputs as
main, extras, and demographics, with duplicated indicators removed.

It drops redundant columns where the same numbers had been returned from API
using the normal name and a synonym name, as with "TOTALPOP" and "totalPop"

\code{\link[=ejscreenapi1]{ejscreenapi1()}} relies on this function and essentially does this:

\if{html}{\out{<div class="sourceCode">}}\preformatted{ejscreenRESTbroker2table(ejscreenRESTbroker()) 
}\if{html}{\out{</div>}}

Drops the percent signs and makes those values numeric,
converting text like 45\% to the number 45.

To ensure there is one result per input point, even if some points are invalid,
for later steps like ejscreenapi1, ejscreenapi, ejscreenapi_plus, ejscreenit(),
this function will return a row with the right columns but all NA values if the input seems wrong.
}
\keyword{internal}
